package com.vessel.decoration.mvp.ui.activity.shop;

import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.vessel.decoration.BuildConfig;
import com.vessel.decoration.R;
import com.vessel.decoration.app.data.entity.ArtisanInfoResponse;
import com.vessel.decoration.app.data.entity.ShopInfoResponse;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @author Jimq
 * @date 2018/1/10
 */

public class GoodsDetailActivity extends BaseActivity {
    @BindView(R.id.tv_title)
    TextView mTitles;
    @BindView(R.id.goods_title)
    TextView mTitle;
    @BindView(R.id.goods_price)
    TextView mPrice;
    @BindView(R.id.goods_dec)
    TextView mDec;
    @BindView(R.id.goods_iv)
    ImageView mGoodsIv;
    private ShopInfoResponse.ProductsBean info;
    private ArtisanInfoResponse.SkillsBean info2;

    @Override
    public void setupActivityComponent(AppComponent appComponent) {
    }

    @Override
    public int initView(Bundle savedInstanceState) {
        return R.layout.activity_goods_detail;
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        mTitles.setText("商品详情");
        info = (ShopInfoResponse.ProductsBean) getIntent().getSerializableExtra("info");
        info2 = (ArtisanInfoResponse.SkillsBean) getIntent().getSerializableExtra("info2");
        if (info != null) {
            Glide.with(getApplicationContext()).load(BuildConfig.APP_DOMAIN + info.getProductPic()).into(mGoodsIv);
            mTitle.setText(info.getProductName());
            mPrice.setText("¥" + info.getPrice() + "元");
            mDec.setText(info.getRemark());
        } else if (info2 != null) {
            Glide.with(getApplicationContext()).load(BuildConfig.APP_DOMAIN + info2.getSkillPic()).into(mGoodsIv);
            mTitle.setText(info2.getSkillName());
            mPrice.setText("¥" + info2.getPrice() + "元");
            mDec.setText(info2.getRemark());
        }
    }

    @OnClick(R.id.iv_left)
    void onClick() {
        finish();
    }
}
